#include<iostream>

using namespace std;

///////////////////////////////// 

//标准棱形继承

/*class Person{
  public:
    string _name;
};

class Teacher :virtual public Person{
  protected:
  public:
    int _id;//工号
};

class Student :virtual public Person{//使用virtual关键字
 // protected:
  public:
    int _num;//学号
};

class Grad : public Teacher ,public Student{
  protected:
    string _major;
};


void test_1(){
  
  Grad grad1;  
//  grad1._name = "Lihua"; 此处出现二义性，虽然指向_name变量，但由于两个派生类都继承了
  grad1.Teacher::_name = "Liming";
  grad1.Student::_name = "Lihua";


  cout<<grad1._name<<endl;
}
*/
////////////////////////////////////// 

//虚继承底层实现
/*class A {
  public:
    int _a;
};

class B :virtual public A{
  public :
    int _b;
};


class C :virtual public A{
  public :
    int _c;
};


class D : public B, public C{
  public :
    int _d;
};

void test_2(){
 D d;
 d.C::_a = 1;
 d.B::_a = 2;
 d._b = 3;
 d._c = 4;
 d._d = 5;


}
*/

//////////////////////////////////////


int main()
{

  //test_1();
  
  test_2();
  return 0;
}
